https://leetcode.cn/problems/permutations/
class Solution {
public:
    vector<vector<int>>ret;
    vector<int> path;
    bool check[7];
    
    void dfs(vector<int>& nums)
    {
        if(nums.size()==path.size())
        {
            ret.push_back(path);
            return ;
            //回溯留到最后处理
        }    

        for(int i=0;i<nums.size();i++)
        {
            if(!check[i])
            {
                path.push_back(nums[i]);
                check[i]=true;
                dfs(nums);
                path.pop_back();
                check[i]=false;
            }
 
        }
    }



    vector<vector<int>> permute(vector<int>& nums) {
        dfs(nums);
        return ret;
    }
};